package com.example.demo.typeEnums;

/**
 * API结果枚举定义
 */
public enum APIResult {
    /** 成功 **/
    OK(0, "成功"),
    OK_PART(0, "只有一部分数据受到影响"),

    /** 异常或其它未知错误 **/
    ERROR(100, "异常或其它未知错误"),
    /** 异常或其它未知错误 **/
    NOT_SUPPORT(101, "不支持该操作"),

    /** 无效的参数 **/
    ILLEGAL_ARGUMENT						(200, "无效的参数"),
    ILLEGAL_ARGUMENT_NOTHING_CHANGED		(200, "没有任何数据受到影响"),


    /*================================= api报文 ==================================*/
    ILLEGAL_REQUEST(240, "无效的请求报文"),
    ILLEGAL_REQUEST_HEADER(241, "无效的Header"),
    ILLEGAL_REQUEST_BODY(242, "无效的Body"),
    ILLEGAL_REQUEST_VERSION(242, "无效的请求报文"),

    /*================================= api验证 ==================================*/
    ILLEGAL_CERTIFICATE(250, "无效的凭证"),
    ILLEGAL_USERNAME(251, "无效的用户名"),
    ILLEGAL_PASSWORD(252, "无效的密码"),
    ILLEGAL_USER_NOT_EXIST(253, "用户不存在"),

    /*================================= api指令==================================*/
    ILLEGAL_INSTRUCTION(300, "无效的指令"),
    ILLEGAL_INSTRUCTION_DEPRECATED(301, "指令已经被废弃"),

    /*================================= api参数和结果==================================*/
    RECORD_NOT_EXISTS(400, "记录不存在"),
    RECORD_ALREADY_EXISTED(401, "记录已存在"),
    BATCH_NOT_SPECIFIED(402, "批次未指定"),
    /**
     * 请求消息不能为空
     */
    REQUEST_MSG_NULL(1000, "Msg cannot be null!"),

    /**
     * 请求消息非法，无法解析
     */
    REQUEST_MSG_ILLEGAL(1001, "Illegal message, unable to parse!"),

    /**
     * 请求head不能为空
     */
    REQUEST_MSG_HEADER_NULL(1002, "Head cannot be null!"),

    /**
     * 请求body不能为空
     */
    REQUEST_MSG_BODY_NULL(1003, "Body cannot be null!"),

    /**
     * channelId不能为空
     */
    REQUEST_CHANNEL_ID_NULL(1004, "ChannelId cannot be null!"),

    /**
     * 请求requestid不能为空
     */
    REQUEST_MSG_REQUESTID_NULL(1005, "RequestId cannot be null!"),

    /**
     * 请求requestId已存在
     */
    REQUEST_ID_DUPLICATE(1006, "RequestId  already exists!"),

    /**
     * 请求消息的msgType不能为空
     */
    REQUEST_MSG_TYPE_NULL(1007, "MsgType cannot be null!"),

    /**
     * 请求消息的msgType不支持
     */
    REQUEST_MSG_TYPE_NOT_SUPPORTED(1008, "MsgType not supported!"),

    ;

    public int code;
    public String msg;

    APIResult(int code, String msg) {
        this.code = code;
        this.msg = msg;
    }

    public int getCode() {
        return code;
    }

    public String getMsg() {
        return msg;
    }

}
